package com.ly.demo.test;

import cn.hutool.core.collection.CollUtil;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

public class OptionalDemo {


    public static void forearch(List<String> names){
        for(String name: Optional.ofNullable(names).orElse(Collections.emptyList())){
            System.out.println(name);
        }
    }

    public static void main(String[] args) {
        OptionalDemo.forearch(null);
    }
}
